package kr.hkit.powerjava.chapter12.inner;

import kr.hkit.powerjava.chapter12.pro.Movable;

class Shape {
	protected int x;
	protected int y;
	public void draw() {
		System.out.println("Shape Draw");
	}
}

class Rectangle extends Shape implements Movable {
	private int width;
	private int height;
	public void draw() {
		System.out.println("Rectangle Draw");
	}
	@Override
	public void move(int dx, int dy) {
		dx = 2;
		dy = 5;
		System.out.println("dx:" + dx + "dy:" + dy);
	}
}

class Triangle extends Shape implements Movable {
	private int base;
	private int height;
	public void draw() {
		System.out.println("Triangle Draw");
	}
	@Override
	public void move(int dx, int dy) {
		// TODO Auto-generated method stub
		
	}
}

class Circle extends Shape implements Movable {
	private int radius;
	public void draw() {
		System.out.println("Circle Draw");
	}
	@Override
	public void move(int dx, int dy) {
		// TODO Auto-generated method stub
		
	}
}

public class ShapeTest {
	private static Shape arrayOFShapes[];
	public static void main(String[] args) {
		init();
		drawAll();
	}
	
	public static void init() {
		arrayOFShapes = new Shape[3];
		arrayOFShapes[0] = new Rectangle();
		arrayOFShapes[1] = new Triangle();
		arrayOFShapes[2] = new Circle();
	}
	
	public static void drawAll() {
		for (int i = 0; i < arrayOFShapes.length; i++) {
			arrayOFShapes[i].draw();
		}
	}
}

